﻿using System;
using System.Collections.Generic;
using System.Windows.Media;
using System.Linq;
using System.Text;
using System.Windows.Data;
using DevExpress.XtraScheduler;
using AppointmentStatus = DevExpress.Xpf.Scheduler.AppointmentStatus;

namespace Agnes.TaskManager
{
    class StatusTypeToColorConvter : IValueConverter
    {
        /// <summary>
        /// Convert
        /// </summary>
        /// <param name="value">AppointmentStatusType</param>
        /// <param name="targetType"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns>SolidColorBrush</returns>
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            foreach (AppointmentStatus i in TaskManagerService.TaskManager.SchedulerStorage.AppointmentStorage.Statuses)
            {
                if (i.Type == (AppointmentStatusType)value)
                {
                    return new SolidColorBrush(i.Color);
                }
            }

            return new SolidColorBrush(Colors.Violet);
        }

        /// <summary>
        /// ConvertBack
        /// </summary>
        /// <param name="value"></param>
        /// <param name="targetType"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
